import request from '@/utils/request'

export function list(data) {
  if (data !== undefined && data.is_page === 0){
    data = {
      ...data,
      pageNum: 1,
      pageSize: 3000,
      enable:1
    }
  }
  return request({
    url: '/xnf/customer/list',
    headers: {
      repeatSubmit: false
    },
    method: 'get',
    params: data
  })
}

export function handleEnable(ids,enable) {
  const data = {
    ids:ids,
    enable:enable
  }
  return request({
    url: '/xnf/customer/switch/enable',
    headers: {
      repeatSubmit: false
    },
    method: 'put',
    data: data
  })
}

export function add(params) {
  const data = {
    ...params
  }
  return request({
    url: '/xnf/customer',
    headers: {
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })
}

export function update(params) {
  const data = {
    ...params
  }
  return request({
    url: '/xnf/customer/update',
    headers: {
      repeatSubmit: false
    },
    method: 'put',
    data: data
  })
}
export function detail(id) {

  return request({
    url: '/xnf/customer/'+id,
    headers: {
      repeatSubmit: false
    },
    method: 'get',
  })
}
export function del(id) {

  return request({
    url: '/xnf/customer/'+id,
    headers: {
      repeatSubmit: false
    },
    method: 'delete',
    data: {
      ids:[id]
    }
  })
}
